/*
 * @Author: wuqingchun
 * @Date: 2024-09-24 17:28:40
 * @Description: 配置参数解析
 * @LastEditors: wuqingchun
 * @LastEditTime: 2024-09-24 20:12:25
 */

#ifndef __CHAT_CONFIG_H__
#define __CHAT_CONFIG_H__

#include <cstdint>
#include <string>

typedef struct tagChatMysqlConfig
{
    std::string strHost;
    uint16_t    usPort;
    std::string strUser;
    std::string strPassword;
    std::string strDBName;
    std::string strCharset;
}CHAT_MYSQL_CONFIG_S;

typedef struct tagChatRedisConfig
{
    std::string strHost;
    uint16_t    usPort;
}CHAT_REDIS_CONFIG_S;

typedef struct tagChatCommonConfig
{
    uint16_t    usListenPort;
    uint16_t    usNetThreadNum;
}CHAT_COMMON_CONFIG_S;

class CChatConfig
{
public:
    static CChatConfig& GetInstance();
    int32_t Init();

    const CHAT_MYSQL_CONFIG_S& GetMysqlConfig() const;
    const CHAT_REDIS_CONFIG_S& GetRedisConfig() const;
    const CHAT_COMMON_CONFIG_S& GetCommonConfig() const;
private:
    CChatConfig();

private:
    CHAT_REDIS_CONFIG_S  m_stRedisConfig;
    CHAT_MYSQL_CONFIG_S  m_stMysqlConfig;
    CHAT_COMMON_CONFIG_S m_stCommConfig;
};

#endif //__CHAT_CONFIG_H__